/* 基础变量 */
$primary-color: #fd6d13;
$secondary-color: #2ecc71;
$background-color: #f5f5f5;
$text-color: #333;
$border-color: #ddd;
$error-color: #e74c3c;
$success-color: #27ae60;
$box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);

/* 全局重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: $background-color;
  color: $text-color;
  width: 800px;
  height: 600px;
  overflow: hidden;
}

/* 容器 */
.container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* 头部 */
.header {
  background-color: $primary-color;
  color: white;
  padding: 10px 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;

  h1 {
    font-size: 18px;
    margin: 0;
  }
}

/* 标签页 */
.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  padding: 6px 12px;
  background-color: transparent;
  border: none;
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;

  &.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
  }

  &:hover {
    background-color: rgba(255, 255, 255, 0.15);
  }
}

/* 标签内容 */
.tab-content {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background-color: white;

  &.active {
    display: flex;
    flex-direction: column;
  }
}

/* URL容器 */
.url-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.method-select {
  width: 100px;
  padding: 8px;
  border: 1px solid $border-color;
  border-radius: 4px;
  background-color: white;
}

.url-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid $border-color;
  border-radius: 4px;
  font-size: 14px;

  &:focus {
    outline: none;
    border-color: $primary-color;
  }
}

.send-button {
  padding: 8px 15px;
  background-color: $secondary-color;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;

  &:hover {
    background-color: darken($secondary-color, 5%);
  }
}

/* 请求标签 */
.request-tabs {
  display: flex;
  border-bottom: 1px solid $border-color;
  margin-bottom: 15px;
}

.request-tab {
  padding: 8px 15px;
  background-color: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;

  &.active {
    border-bottom-color: $primary-color;
    color: $primary-color;
  }
}

/* 请求内容 */
.request-content {
  display: none;
  margin-bottom: 20px;

  &.active {
    display: block;
  }
}

/* 参数和请求头表格 */
.param-row, .header-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  align-items: center;

  &.header-row {
    font-weight: bold;
    color: #666;
  }
}

.checkbox-cell {
  width: 24px;
}

.key-cell, .value-cell {
  flex: 1;

  input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid $border-color;
    border-radius: 3px;

    &:focus {
      outline: none;
      border-color: $primary-color;
    }
  }
}

.action-cell {
  width: 30px;
  text-align: center;

  button {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;

    &:hover {
      color: $error-color;
    }
  }
}

.add-button {
  margin-top: 8px;
  padding: 6px 12px;
  background-color: #f0f0f0;
  border: 1px solid $border-color;
  border-radius: 4px;
  cursor: pointer;

  &:hover {
    background-color: #e5e5e5;
  }
}

/* 请求体编辑器 */
#body-editor {
  margin-top: 10px;
  width: 100%;
  min-height: 150px;
  border: 1px solid $border-color;
  border-radius: 4px;
}

/* 响应部分 */
.response-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-top: 1px solid $border-color;
  padding-top: 15px;
  margin-top: 15px;
}

.response-header {
  display: flex;
  align-items: center;
  margin-bottom: 10px;

  h3 {
    margin-right: 10px;
  }

  .status-code {
    padding: 3px 8px;
    border-radius: 3px;
    font-weight: bold;
    margin-right: 10px;

    &.success {
      background-color: rgba($success-color, 0.1);
      color: $success-color;
    }

    &.error {
      background-color: rgba($error-color, 0.1);
      color: $error-color;
    }
  }

  .response-time {
    color: #666;
    font-size: 13px;
  }
}

.response-tabs {
  display: flex;
  margin-bottom: 10px;
}

.response-tab {
  padding: 6px 12px;
  background-color: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;

  &.active {
    border-bottom-color: $primary-color;
    color: $primary-color;
  }
}

.response-content {
  display: none;
  flex: 1;
  overflow: auto;

  &.active {
    display: block;
  }
}

#response-body {
  background-color: #f8f8f8;
  padding: 10px;
  border-radius: 4px;
  overflow: auto;
  font-family: monospace;
  white-space: pre-wrap;
  height: 100%;
}

#response-headers-list {
  .header-item {
    padding: 6px 0;
    border-bottom: 1px solid $border-color;
    display: flex;

    .header-name {
      font-weight: bold;
      width: 150px;
    }
  }
}

/* 保存的请求和历史记录列表 */
.saved-list, .history-list {
  flex: 1;
  overflow: auto;
}

.saved-item, .history-item {
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid $border-color;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;

  &:hover {
    background-color: rgba($primary-color, 0.05);
  }

  .item-method {
    font-weight: bold;
    display: inline-block;
    width: 60px;
  }

  .item-url {
    color: $primary-color;
  }

  .item-date {
    color: #666;
    font-size: 12px;
    margin-top: 5px;
  }
}

.empty-state {
  text-align: center;
  padding: 30px;
  color: #999;
}

/* 添加网站请求记录相关样式 */

/* 站点信息 */
.site-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 15px;
  background-color: #f5f5f5;
  border-bottom: 1px solid $border-color;
  
  h3 {
    font-size: 12px;
    margin: 0;
    font-weight: 600;
    color: #333;
  }
  
  .refresh-button {
    padding: 2px 8px;
    background-color: #2196f3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 12px;
    
    &:hover {
      background-color: #0b7dda;
    }
  }
}

.site-url-wrapper {
  position: relative;
  padding: 5px 15px 10px;
  background-color: #f5f5f5;
  margin-bottom: 10px;
  
  .site-url-container {
    display: flex;
    align-items: center;
    background-color: white;
    border: 1px solid $border-color;
    border-radius: 4px;
    padding: 0 10px;
    position: relative;
  }
  
  .site-url-text {
    flex: 1;
    padding: 8px 0;
    font-size: 13px;
    color: #333;
    overflow-wrap: break-word;
    word-break: break-all;
    line-height: 1.4;
    font-family: 'Consolas', monospace;
  }
  
  .copy-url-button {
    position: absolute;
    right: 4px;
    top: 4px;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
    
    &:hover {
      color: $primary-color;
    }
    
    .copy-icon {
      font-size: 14px;
    }
  }
  
  .copy-feedback {
    position: absolute;
    right: 15px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 12px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    
    &.show {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

/* 请求列表工具栏 */
.requests-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.filter-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid $border-color;
  border-radius: 4px;
  font-size: 13px;
  
  &:focus {
    outline: none;
    border-color: $primary-color;
  }
}

.filter-select {
  width: 120px;
  padding: 6px;
  border: 1px solid $border-color;
  border-radius: 4px;
  font-size: 13px;
}

.clear-button {
  padding: 6px 10px;
  background-color: #f0f0f0;
  border: 1px solid $border-color;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  
  &:hover {
    background-color: #e5e5e5;
  }
}

/* 请求列表 */
.requests-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.requests-list-header {
  display: flex;
  background-color: #f0f0f0;
  padding: 8px 10px;
  font-weight: bold;
  font-size: 13px;
  color: #666;
  border-top: 1px solid $border-color;
  border-bottom: 1px solid $border-color;
}

.requests-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid $border-color;
  border-top: none;
}

.request-item {
  display: flex;
  padding: 8px 10px;
  border-bottom: 1px solid $border-color;
  font-size: 13px;
  cursor: pointer;
  transition: background-color 0.2s;
  
  &:hover {
    background-color: rgba($primary-color, 0.05);
  }
  
  &.selected {
    background-color: rgba($primary-color, 0.1);
  }
}

.request-method {
  width: 70px;
  font-weight: 500;
  
  &.get { color: #27ae60; }
  &.post { color: #e67e22; }
  &.put { color: #3498db; }
  &.delete { color: #e74c3c; }
  &.patch { color: #9b59b6; }
  &.other { color: #7f8c8d; }
}

.request-url {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-status {
  width: 60px;
  text-align: center;
  
  &.success { color: #27ae60; }
  &.error { color: #e74c3c; }
  &.pending { color: #3498db; }
}

.request-type {
  width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.request-time {
  width: 80px;
  text-align: right;
}

.request-debug {
  width: 60px;
  text-align: center;
}

.debug-button {
  padding: 3px 8px;
  background-color: $primary-color;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
  
  &:hover {
    background-color: darken($primary-color, 10%);
  }
}

.requests-empty-state {
  border: 1px dashed $border-color;
  border-top: none;
  padding: 20px;
  text-align: center;
  color: #999;
  font-size: 14px;
}

.request-name-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  
  .request-name-input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    
    &:focus {
      border-color: #2196f3;
      outline: none;
    }
  }
  
  .save-button {
    margin-left: 10px;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.3s;
    
    &:hover {
      background-color: #388e3c;
    }
  }
}

.saved-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.saved-search-container {
  margin-bottom: 10px;
}

.search-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid $border-color;
  border-radius: 4px;
  font-size: 14px;

  &:focus {
    outline: none;
    border-color: $primary-color;
  }
}

.saved-list-header {
  display: flex;
  background-color: #f5f5f5;
  border-bottom: 1px solid #ddd;
  font-weight: bold;
  padding: 8px;
  position: sticky;
  top: 0;
  z-index: 1;
  
  .saved-method {
    width: 80px;
    padding: 0 8px;
  }
  
  .saved-name {
    flex: 2;
    padding: 0 8px;
  }
  
  .saved-url {
    flex: 3;
    padding: 0 8px;
  }
  
  .saved-actions {
    width: 120px;
    text-align: center;
  }
}

#saved-requests-list {
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}

.saved-request-item {
  display: flex;
  padding: 8px;
  border-bottom: 1px solid #eee;
  align-items: center;
  transition: background-color 0.2s;
  
  &:hover {
    background-color: #f9f9f9;
  }
  
  .saved-method {
    width: 80px;
    padding: 0 8px;
    
    .method-badge {
      display: inline-block;
      padding: 2px 6px;
      border-radius: 3px;
      font-size: 12px;
      font-weight: bold;
      color: white;
      
      &.get { background-color: #61affe; }
      &.post { background-color: #49cc90; }
      &.put { background-color: #fca130; }
      &.delete { background-color: #f93e3e; }
      &.patch { background-color: #50e3c2; }
      &.head, &.options { background-color: #9012fe; }
    }
  }
  
  .saved-name {
    flex: 2;
    padding: 0 8px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .saved-url {
    flex: 3;
    padding: 0 8px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .saved-actions {
    width: 120px;
    display: flex;
    justify-content: center;
    gap: 8px;
    
    button {
      padding: 4px 8px;
      border: none;
      border-radius: 3px;
      cursor: pointer;
      transition: background-color 0.2s;
      
      &.debug-button {
        background-color: #2196f3;
        color: white;
        
        &:hover {
          background-color: #0b7dda;
        }
      }
      
      &.delete-button {
        background-color: #f44336;
        color: white;
        
        &:hover {
          background-color: #d32f2f;
        }
      }
    }
  }
}

/* 通知提示框 */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 4px;
  color: white;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
  transform: translateY(-100px);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 9999;
  
  &.success {
    background-color: #4caf50;
  }
  
  &.error {
    background-color: #f44336;
  }
  
  &.show {
    transform: translateY(0);
    opacity: 1;
  }
}

/* 对话框遮罩层 */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9998;
}

/* 确认对话框 */
.confirm-dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 320px;
  background-color: white;
  border-radius: 4px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  z-index: 9999;
  
  .dialog-message {
    margin-bottom: 20px;
    font-size: 16px;
    color: #333;
    text-align: center;
  }
  
  .dialog-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    
    .dialog-button {
      padding: 8px 20px;
      border: none;
      border-radius: 4px;
      font-weight: 500;
      cursor: pointer;
      transition: background-color 0.2s;
      
      &.cancel-button {
        background-color: #f1f1f1;
        color: #333;
        
        &:hover {
          background-color: #e1e1e1;
        }
      }
      
      &.confirm-button {
        background-color: #f44336;
        color: white;
        
        &:hover {
          background-color: #d32f2f;
        }
      }
    }
  }
}

/* 请求体相关样式 */
.body-none-message {
  color: #999;
  text-align: center;
  padding: 20px;
  font-style: italic;
  background-color: #f9f9f9;
  border-radius: 4px;
  border: 1px dashed #ddd;
}

.form-container {
  border: 1px solid $border-color;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 15px;
  
  .form-row {
    display: flex;
    border-bottom: 1px solid $border-color;
    
    &:last-child {
      border-bottom: none;
    }
    
    &.header-row {
      background-color: #f5f5f5;
      font-weight: bold;
      color: #666;
    }
    
    .checkbox-cell {
      width: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-right: 1px solid $border-color;
    }
    
    .key-cell, .value-cell {
      flex: 1;
      padding: 8px;
      
      input {
        width: 100%;
        padding: 6px 8px;
        border: 1px solid $border-color;
        border-radius: 3px;
        
        &:focus {
          outline: none;
          border-color: $primary-color;
        }
      }
    }
    
    .key-cell {
      border-right: 1px solid $border-color;
    }
    
    .action-cell {
      width: 40px;
      display: flex;
      align-items: center;
      justify-content: center;
      
      button {
        background: none;
        border: none;
        color: #999;
        cursor: pointer;
        font-size: 18px;
        
        &:hover {
          color: $error-color;
        }
      }
    }
  }
  
  .form-items-container {
    max-height: 200px;
    overflow-y: auto;
  }
  
  .add-button {
    display: block;
    width: 100%;
    padding: 8px;
    background-color: #f5f5f5;
    border: none;
    border-top: 1px solid $border-color;
    cursor: pointer;
    transition: background-color 0.2s;
    
    &:hover {
      background-color: #eaeaea;
    }
  }
}

.raw-editor-container {
  display: flex;
  flex-direction: column;
  border: 1px solid $border-color;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
  
  .raw-format-selector {
    display: flex;
    background-color: #f5f5f5;
    border-bottom: 1px solid $border-color;
    
    .format-button {
      padding: 8px 12px;
      background: none;
      border: none;
      cursor: pointer;
      
      &.active {
        background-color: white;
        font-weight: bold;
        box-shadow: inset 0 3px 0 $primary-color;
      }
      
      &:hover:not(.active) {
        background-color: rgba(0, 0, 0, 0.05);
      }
    }
  }
  
  .raw-editor {
    padding: 10px;
    min-height: 200px;
    border: none;
    resize: vertical;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.5;
    width: 100%;
    
    &:focus {
      outline: none;
    }
    
    &.json-editor {
      color: #444;
    }
    
    &.xml-editor, &.html-editor {
      color: #622569;
    }
  }
}

.format-json-button {
  display: block;
  margin: 0 0 15px auto;
  padding: 6px 12px;
  background-color: #f0f0f0;
  border: 1px solid $border-color;
  border-radius: 4px;
  cursor: pointer;
  
  &:hover {
    background-color: #e5e5e5;
  }
}

.file-upload-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  border: 2px dashed $border-color;
  border-radius: 4px;
  margin-bottom: 15px;
  
  .file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    background-color: $primary-color;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 10px;
    
    .file-icon {
      margin-right: 8px;
      
      &:before {
        content: '\f15b';
        font-family: 'FontAwesome', sans-serif;
      }
    }
    
    &:hover {
      background-color: darken($primary-color, 10%);
    }
  }
  
  .file-upload-input {
    display: none;
  }
  
  .file-info {
    font-size: 14px;
    color: #666;
  }
} 